package demo2;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: 石方旭
 * Date: 2022-04-06
 * Time: 16:48
 */

class Animal {
    protected String name;
    public void eat() {
        System.out.println("吃吃吃！！！");
    }
    protected int age;
    public void method1() {
        System.out.println(this.age);
        System.out.println(this.name);//访问同一包的同一类
    }
}
class Dog extends Animal{
    public void bark(){
        System.out.println("汪汪汪！！！");
    }

}
public class TestDemo2 {
    protected int m =1000;
    public static void main(String[] args) {
        Dog dog = new Dog();
        System.out.println(dog.age);//访问同一包的不同类
        dog.eat();
    }
}
